//1.创建文件 /widget/page_content.dart
//2.添加material依赖
import 'package:flutter/material.dart';
import 'package:power_house/routes.dart';

//3.编写无状态组件
class PageContent extends StatelessWidget {
  //4.添加name参数
  final String name;

  const PageContent({super.key, required this.name});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(
          '当前页面:$name',
          textAlign: TextAlign.center,
        ),
      ),
      body: ListView(
        children: <Widget>[
          ElevatedButton(
              child: Text(Routes.home),
              onPressed: () {
                Navigator.pushNamed(context, Routes.home);
              }),
          ElevatedButton(
              child: Text(Routes.login),
              onPressed: () {
                Navigator.pushNamed(context, Routes.login);
              }),
          ElevatedButton(
              child: const Text("错误页面"),
              onPressed: () {
                Navigator.pushNamed(context, 'aaa');
              }),
          ElevatedButton(
              child: const Text("房屋详情"),
              onPressed: () {
                Navigator.pushNamed(context, "/room/2222");
              }),
          ElevatedButton(
              child: const Text("注册"),
              onPressed: () {
                Navigator.pushNamed(context, '/register');
              })
        ],
      ),
    );
  }
}
//5.**使用 Scaffold**
